//
//  Car.m
//  CarPartsInit
//
//  Created by quentin on 15/9/16.
//  Copyright (c) 2015年 QuentinLabs. All rights reserved.
//

#import "Car.h"
#import "Engine.h"


@implementation Car

-(id)init
{
    if (self == [super init]) {
        tires = [[NSMutableArray alloc]init];
        for (int i = 0; i <4;i++) {
            [tires addObject:[NSNull null]];
        }
    }
    return self;
}

-(void) setEngine:(Engine *)newEngine
{
    //[newEngine retain];
    //[engine release];
    //engine = newEngine;
}

-(Engine*) engine
{
    return (engine);
}

-(void) setTire:(Tire *)tire atIndex:(int)index
{
    [tires replaceObjectAtIndex:index withObject:tires];
}

-(Tire*) tireAtIndex:(int)index
{
    Tire* tire;
    tire = [tires objectAtIndex:index];
    return (tire);
}

-(void)print
{
    for (int i = 0; i <4; i++) {
        NSLog(@"%@",[self tireAtIndex:i]);
    }
    NSLog(@"%@",engine);
}
@end
